<!--
 * @Descripttion: 
 * @Version: 
 * @Author: gaohj
 * @Date: 2023-01-10 19:43:54
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2023-01-10 19:54:55
-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body{
            width: 3000px;
            height: 3000px;
        }
    </style>
    <script>
        // var content = document.getElementById('test').innerHTML;
        // alert(content); 报错

        // window.onload = function(){
        //     var content = document.getElementById('test').innerHTML;
        //     alert(content);
        //     //当页面上所有的元素都加载完成之后才会执行这里边代码
        // }
        // window.onload = function(){
        //     var content = document.getElementById('test').innerHTML;
        //     alert(content+'哈哈');
        //     //当页面上所有的元素都加载完成之后才会执行这里边代码
        // }

        // 两个window.onload 后边的会覆盖前边的
        // window.onresize = function(){
        //     console.log('窗口大小改变了','宽是:'+window.innerWidth,'高是:'+window.innerHeight);
        // }

        window.onscroll = function(){
            console.log('滚动条滚动了');
        }
    </script>
</head>
<body>
    <div id="test">我是body中的内容</div>
</body>
</html>